crypto-policies: add MinProtocol, Ciphersuites, and key=value config format#10535
Open
dom-omg wants to merge 1 commit into
Open
crypto-policies: add MinProtocol, Ciphersuites, and key=value config format#10535dom-omg wants to merge 1 commit into
dom-omg wants to merge 1 commit into
Conversation
…format Extend the system crypto-policy support to parse a config file in the same key=value format as OpenSSL's opensslcnf.config backend, so that fedora-crypto-policies can generate a wolfssl.config with explicit MinProtocol, CipherString, and Ciphersuites keys. Changes: - crypto_policy_parse(): detect legacy @SECLEVEL= format (backward compat) OR new key=value format; new format supports MinProtocol, DTLS.MinProtocol, CipherString, Ciphersuites. - wolfSSL_crypto_policy_init_ctx(): honour explicit MinProtocol / DTLS.MinProtocol from the config, overriding the SECLEVEL-derived minimum TLS version. - wolfSSL_CTX_new_ex(): also apply Ciphersuites (TLS 1.3) from config. - wolfSSL_crypto_policy_enable(): use XMALLOC for the read buffer so multi-line files up to MAX_WOLFSSL_CRYPTO_POLICY_FILE_SIZE (4096 B) are accepted. - Add wolfSSL_crypto_policy_get_min_downgrade(), wolfSSL_crypto_policy_get_min_dtls_downgrade(), wolfSSL_crypto_policy_get_ciphersuites() internal accessors. - Update example policy files to new format. - SystemCryptoPolicy struct: add explicitMinDowngrade, explicitMinDtlsDowngrade, cipherSuites fields. Satisfies fedora-crypto-policies work item wolfSSL#60: wolfSSL now reads a config file in the same style as opensslcnf.config and calls the wolfSSL API to actually enforce MinProtocol and cipher constraints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Can one of the admins verify this patch? |
Contributor
|
Hi @dom-omg, thank you for the PR! I'm reviewing this in addition to #10541. Could you email support@wolfssl.com for a contributor agreement? Best, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the Fedora system crypto-policy support (added in #8205) to parse config files in the same key=value format as OpenSSL's
opensslcnf.configbackend, and to actually call wolfSSL API to enforce every policy parameter read from the file.What was missing (fedora-crypto-policies work item #60)
The original implementation only parsed a single-line
@SECLEVEL=N:cipher_stringformat and applied the cipher list. It did not:MinProtocol = TLSv1.2keyCiphersuites = ...key for TLS 1.3 suitesopensslcnf.configso thatfedora-crypto-policiescan generate awolfssl.configwith the same toolingChanges
wolfssl/internal.hexplicitMinDowngradeandexplicitMinDtlsDowngradefields toSystemCryptoPolicyto store values fromMinProtocol/DTLS.MinProtocolkeys.cipherSuites[]field for TLS 1.3Ciphersuiteskey.MAX_WOLFSSL_CRYPTO_POLICY_FILE_SIZE = 4096for multi-line configs.src/ssl.ccrypto_policy_parse(): detects legacy@SECLEVEL=format (fully backward-compatible) or new key=value format.MinProtocol,DTLS.MinProtocol,CipherString,Ciphersuites. Unknown keys silently ignored.wolfSSL_crypto_policy_enable(): allocates a temporary buffer withXMALLOCso multi-line files up to 4 KiB are accepted.wolfSSL_CTX_new_ex(): also appliesCiphersuites(TLS 1.3) when set.wolfSSL_crypto_policy_get_min_downgrade(),wolfSSL_crypto_policy_get_min_dtls_downgrade(),wolfSSL_crypto_policy_get_ciphersuites().src/internal.cwolfSSL_crypto_policy_init_ctx(): after derivingminDowngradefrom@SECLEVEL, overrides it with the explicitMinProtocolvalue if one was provided.Example files — updated to new format:
Backward compatibility
The old single-line
@SECLEVEL=N:cipher_stringformat still works —wolfSSL_crypto_policy_enable_buffer()with the legacy format passes all existing tests unchanged.Test plan
test_wolfSSL_crypto_policy(buffer path with@SECLEVEL=strings) continues to passwolfSSL_crypto_policy_enable()with new-format files sets correctsecLevel,minDowngrade, cipher listDTLS.MinProtocolsetsminDowngradefor DTLS contexts🤖 Generated with Claude Code